package com.the_ring.behavior.strategy;

/**
 * @author: t22306139
 * @date: 2023/12/1  10:57
 */
public class MainTest {

    public static void main(String[] args) throws InstantiationException, IllegalAccessException {
        Strategy strategy1 = CalcEnum.ADD.getClazz().newInstance();
        int result1 = strategy1.calc(1, 2);
        System.out.println("1 + 2 = " + result1);

        Strategy strategy2 = CalcEnum.SUBTRACT.getClazz().newInstance();
        int result2 = strategy2.calc(5, 3);
        System.out.println("5 - 3 = " + result2);
    }
}
